<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="/fuman/js/product.js"></script>
<script language="javascript">
	function doRecommend(t)
	{
		var str = selectallpro();
		if(t==2){ //请求下架显示界面
			if(str != false){
				$("#dorecommendform").show();
			}

		}else{
			//t == 1  确认下架  t == 3 请求下架
			if (str != false) {
				if(t==3){
					var temp=document.getElementsByName("reason");
					for (i=0;i<temp.length;i++){
						//遍历Radio
						if(temp[i].checked)
						{
							var r = temp[i].value;
						}
					}
					if(r ==1){
						var reason = "季节性产品";
					}
					if(r ==2){
						var reason = "销量低";
					}
					if(r ==3){
						var reason = "产品涉及侵权";
					}
					if(r ==4){
						var reason = $("#address").val();
						if(reason){
						}else{
							alert("下架原因必须填写");return false;
						}
					}
					var descr = $("#descr").val();
				}else{
					var reason = "";
					var descr  = "";
				}
				//alert(reason);return false;
				if (confirm("确认请求修改状态为下架商品?")) {
					$.post("/externalBuy/ajaxbutton", {"op": "changMaintenancestatus","parid":str,"t":t,"reason":reason,"descr":descr},
							function(data){
								if(data==200)
								{
									window.location.reload();
								}

							},"json");
				}
			}
		}




	}
	function dosaveSKU()
	{
		var str = selectallpro();
		if (str != false) {
			if (confirm("你确认将所选的SKU添加进自己的维护列表?")) {
					 $.post("/externalBuy/ajaxbutton", {"op": "saveMaintenanceSKU","parid":str},
					  function(data){
							if(data==200)
							{
								window.location.reload();
							}
							
					   },"json");	
			 }	
		}
	}
</script>
<title>商品维护列表</title>
<body class="withvernav">
<div class="bodywrapper">
	{{include file='/public/leftmenu.tpl'}}
	<div class="centercontent">
		<div class="pageheader notab">
			<h1 class="pagetitle">商品维护列表</h1>
			<span class="pagedesc"></span>
			<div class="menulist">
				<ul class="profile_summary">
					<li>
						<a href="/externalBuy/ajaxbutton?op=productStatusList" target="_blank">
							<span>下架商品列表</span>
						</a>
					</li>
				</ul>
			</div>
		</div>
		<!--pageheader-->

		<div id="contentwrapper" class="contentwrapper">
			<div id="basicform" class="subcontent">
            
            <div>
            <div style="float:left">
				
              
              {{if  in_array('311',$showpower)}}
			  <button class="stdbtn btn_red" onClick="doRecommend(1);return false;">确认暂停销售</button>&nbsp;&nbsp;&nbsp;
              {{else}}
              <button class="stdbtn btn_blue" onClick="dosaveSKU();return false;">加入维护列表</button>&nbsp;&nbsp;&nbsp;
			  <button class="stdbtn btn_lime" onClick="doRecommend(2);return false;">请求暂停销售</button>&nbsp;&nbsp;&nbsp;
              {{/if}}
              
              {{if $managers}}
              	<button class="stdbtn btn_red" onClick="doRecommend(1);return false;">确认暂停销售</button>&nbsp;&nbsp;&nbsp;
              {{/if}}
              </div>
				<!--搜索栏-->
				<div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
			</div>
			  <form class="stdform stdform2" method="get" id="search" action="/externalBuy/Maintenance">

					<div class="tableoptions">

						关键词: <input type="text" name="sku" id="sku" class="width300" value="{{$other}}" placeholder="商品编号、商品名称"/>
						&nbsp;
                        销售建议:
						<select class="selectCss2" name="status" id="status">
							<option value="">请选择</option>
							<option value="1" {{if $status==1}} selected{{/if}}>建议下架</option>
							<option value="2" {{if $status==2}} selected{{/if}}>建议销售</option>
						</select>
						<button class="btn btn_orange btn_search radius50">Search</button>
					</div>

				</form>
				<!--搜索栏结束-->
				<table cellpadding="0" cellspacing="0" border="0" class="stdtable">
					<thead>
					<tr class="lbbt">
						<td width="5%" bgcolor="#FEFFF1"><a onClick="allSelect('ppid[]')">全选</a></td>
						<td width="8%" bgcolor="#FEFFF1">商品编号</td>
						<td width="20%" bgcolor="#FEFFF1">商品名称</td>
						<td width="5%" bgcolor="#FEFFF1">成本价</td>
						<td width="5%" bgcolor="#FEFFF1">直发总销量</td>
						<td width="5%" bgcolor="#FEFFF1">FBA总销量</td>
                        <td width="8%" bgcolor="#FEFFF1">状态</td>
						<td width="9%" bgcolor="#FEFFF1">创建时间</td>
						<td  bgcolor="#FEFFF1">建议</td>
					  </tr>
					</thead>

					{{foreach from=$goodslist item=li key=key}}
					<tbody id="bdetail{{$detail.p_parent_id}}">
					<!-- 超级管理员 创建人  已完成   -->
					<tr>
						<td><input name="ppid[]" type="checkbox" class="none" id="ppid[]" value="{{$li.p_parent_id}}" /></td>
						<td valign="middle" style="position:relative;">
							<a href="javascript:void(0);" onClick="window.open('/product/productlist?other={{$li.p_parent_sku}}');">{{$li.p_parent_sku}}</a>
						</td>
						<td style="width: 50px; overflow:hidden;white-space:nowrap; text-overflow:ellipsis;">
							<div class="lbcp">
								{{$li.p_parent_name}}<br>
							</div>
						</td>

						<td valign="middle">{{$li.p_costprice}}</td>
						<td class="cz">{{$li.allday1}}</td>
						<td class="cz">{{$li.allday2}}</td>
                        <td class="cz">
                        	{{if $li.p_buyer==11111}}
                            	<font color="red">维护人员已确定</font>
                            {{/if}}
                            {{if $li.p_buyer==9999 || $li.p_buyer==6666 || $li.p_buyer==7777 || $li.p_buyer==8888}}
                            	<font color="blue">待维护人员确认</font>
                            {{/if}}
                            </td>
						<td class="cz">{{$li.p_updatetime}}</td>
						<!--
						<td class="cz">
							<element title="{{$li.sizeinfo}}">{{$li.sizeinfo}}</element>
						</td>
						<td class="cz"><element title="{{$li.fabricinfo}}">{{$li.fabricinfo}}</element></td>
						-->
						<td class="cz">
							{{$li.memo}}
						</td>
				    </tr>
					{{/foreach}}
				</table>
				<div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
			</div>
		</div>
		<!-- 是否确认上架弹出框-->
		<!-- 模态框（Modal）交运内容 -->
		<form action="/externalBuy/doRecommendGoods" enctype="multipart/form-data" method="post" name="dorecommendattributeform" id="dorecommendattributeform" target="_blank" style="font-size: 14px;font-family: Helvetica, 'Hiragino Sans GB', 'Microsoft Yahei', '微软雅黑', Arial, sans-serif;line-height: 21px;color: #666;">
			<div class="modal" id="dorecommendform" tabindex="-1" role="dialog" aria-labelledby="sexpressform" aria-hidden="true" style="margin-top: 60px;padding-top:60px;">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"
							        aria-hidden="true" onClick="javascript:$('#dorecommendform').hide();">× </button>
							<h4 class="modal-title"><span id="addsure" style="font-size:18px;">请求下架</span></h4>
						</div>
						<div class="modal-body">
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td align="left" width="20%"><span id="showname">下架原因</td>
									<td align="left" width="80%">
                                <span id="settext">
	                                <input type='radio' name='reason'  value='1' checked> 季节性产品<br/>
					                <input type='radio' name='reason'  value='2'> 销量低<br/>
	                                <input type='radio' name='reason'  value='3'> 商品涉及侵权<br/>
					                <input type='radio' name='reason'  value='4' > 其他原因&nbsp;&nbsp;
					                <input type='text'  name='address' id='address' placeholder='请输入取消原因'/>
                                </span>
									</td>
								</tr>
								<tr>
									<td align="left">备注：</td>
									<td  align="left">
										<span>
										<input type='text'  name='descr' id='descr' placeholder='请输入相关备注'/>
										</span>
									</td>
								</tr>
							</table>
							<div class="modal-footer">
								<button type="button" class="btn btn-default"
								        data-dismiss="modal" style="display:none"> 关闭 </button>
								<button type="button" class="btn btn-primary"  onclick="doRecommend(3)">保存</button>
							</div>
						</div>
						<!-- /.modal-content -->
					</div>
					<!-- /.modal-dialog -->
				</div>
			</div>
		</form>
		<!-- /.modal -->
		
  <div id="goToTop" style="display:none"><a href="javascript:;">TOP</a></div>

</body>
</html>